import 'package:flutter/material.dart';
import 'package:note_life/color.dart';

class ThemeUtil {
  static final int BRIGHT_THEME = 0X0000000;
  static final int DARK_THEME = 0X0000001;
  static int _type = BRIGHT_THEME;

  static void changeTheme(int type) {
    _type = type;
    AppColor.resetThemeColor();
    AppColor.resetBgColor();
    _themechange();
  }

  static int get type => _type;

  static ThemeChangeCallBack _themechange;

  static ThemeData getTheme(ThemeChangeCallBack themechange) {
    if (_themechange == null) _themechange = themechange;
    print(_darkTheme.cardColor);
    if (_type == BRIGHT_THEME) {
      return _brightTheme;
    } else {
      return _darkTheme;
    }
  }

  static var _brightTheme = ThemeData(
      primaryColor: Colors.white,
      primaryTextTheme: TextTheme(title: TextStyle(color: AppColor.TEXT_BLACK)),
      backgroundColor: Colors.white,
      scaffoldBackgroundColor: Colors.white,
      dividerColor: AppColor.DIVIDER_COLOR,
      textTheme: TextTheme(title: TextStyle(color: AppColor.TEXT_BLACK)),
      accentTextTheme: TextTheme(title: TextStyle(color: Colors.white)),);
  static var _darkTheme = ThemeData(
      primaryColor: AppColor.DARK_COLOR,
      primaryTextTheme: TextTheme(title: TextStyle(color: Colors.white)),
      backgroundColor: AppColor.DARK_COLOR,
      scaffoldBackgroundColor: AppColor.DARK_COLOR,
      dividerColor: AppColor.DIVIDER_COLOR,
      textTheme: TextTheme(title: TextStyle(color: Colors.white)),
      accentTextTheme: TextTheme(title: TextStyle(color: Colors.white)),);
}

typedef void ThemeChangeCallBack();
